home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-11 | 1.7 KB | 75 lines | [TEXT/HAks] |
-
-
- Time Sheet Calculator
-
- PURPOSE: To calculate hours worked.
-
- DESCRIPTION: Time values are expressed as Hours.Minutes.
-
- Results are in terms of decimal hour units.
-
- USAGE: h( <TimeClockedIn>, <TimeClockedOut> )
-
- eg. h( 8.00, 12.00 ) = 4.0
- h( 9.00, 1.00 ) = 4.0
-
- ASSUMES: No more than twelve hours are worked at a stretch.
-
-
- EXAMPLE: Edit the clock-in/clock-out times below and press
- the 'Enter' key or 'Shift-Return' to produce the
- new total.
-
- Mon = h( 9.15, 1.45 ) + h( 2.30, 5.30 )
-
- Tue = h( 8.30, 12.00 ) + h( 1.12, 5.00 )
-
- Wed = h( 8.24, 11.12 ) + h( 1.22, 4.30 )
-
- Thr = h( 8.05, 12.02 ) + h( 1.23, 4.45 )
-
- Fri = h( 8.13, 12.14 ) + h( 1.09, 4.00 )
-
- TotalForWeek = Mon + Tue + Wed + Thr + Fri
-
-
- TotalForWeek =
-
- ==============================================================
-
- FUNCTION DEFINITIONS:
-
- These are the building-block functions used:
-
- Get the fractional part of a number:
-
- FractionPart(x) = x - int(x)
-
- Get the number of minutes packed in an hour.minutes
- format number:
-
- MinutePart(h.m) = FractionPart(h.m) * 100
-
- Get the number of hours packed in an hour.minutes
- format number:
-
- HourPart(h.m) = int(h.m)
-
- Convert times in hours.minutes format to decimal
- hour format:
-
- h.mTOh.h( h.m ) = HourPart(h.m) + MinutePart(h.m) / 60
-
- Calculate a new clock-out time that it is
- numerically larger than the clock-in time. A noon
- or midnight adjustment.
-
- NewOut( In, Out ) = h.mTOh.h( if( Out < In, Out+12, Out ) )
-
- This is the main function that computes hours worked:
-
- h( In, Out ) = fix( 1, NewOut( In, Out ) - h.mTOh.h(In) )
-
-
-
-